cmake_minimum_required(VERSION 2.8)
include (GenerateExportHeader)
project(LOGMlib)
FIND_PACKAGE(Qt4 REQUIRED)
SET (LIB_TYPE SHARED)

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/header")
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${QT_QTDEBUG_INCLUDE_DIR})

set(INCS
	"header/stdafx_logm.h"
)

set(SRCS
	src/LogSave.cpp
	src/ViewLog.cpp
)

set(MOC_LogSave_INC "header/LogSave.h")
set(MOC_ViewLog_INC "header/ViewLog.h")

qt4_wrap_cpp(MOC_LogSave_SRC "${MOC_LogSave_INC}")
qt4_wrap_cpp(MOC_ViewLog_SRC "${MOC_ViewLog_INC}")

list(APPEND ADDITIONAL_LIBS ${QT_QTDEBUG_LIBRARY})
list(APPEND SRCS "${MOC_LogSave_SRC}" "${MOC_ViewLog_SRC}")
list(APPEND INCS "${MOC_LogSave_INC}" "${MOC_ViewLog_INC}")

# Create a target for the library
ADD_LIBRARY(LOGMlib ${LIB_TYPE} ${SRCS} ${INCS})
target_link_libraries(LOGMlib ${QT_LIBRARIES} ${ADDITIONAL_LIBS})

GENERATE_EXPORT_HEADER( LOGMlib
             BASE_NAME LOGMlib
             EXPORT_MACRO_NAME LOGMlib_EXPORT
             EXPORT_FILE_NAME LOGMlib_Export.h
             STATIC_DEFINE LOGMLIB_BUILT_AS_STATIC)
			 
set (test_SRCS main.cpp)
ADD_EXECUTABLE (test ${test_SRCS})
TARGET_LINK_LIBRARIES (test LOGMlib)